<extend name="common" />
<block name="main">
<div class="bd api-detail">
    <div class="panel panel-info">
        <div class="panel-heading">
            <h3 class="panel-title">基础信息</h3>
        </div>
        <div class="panel-body">
            <p class="col-lg-12 over-hide"><label class="w-100">接口名称：</label><span>{$api_info.api_name}</span></p>
            <p class="col-lg-12 over-hide"><label class="w-100">接口用途：</label><span>{$api_info.api_intro}</span></p>
            <p class="col-lg-12 over-hide"><label class="w-100">method：</label><span>{$api_info.api_method}</span></p>
            <p class="col-lg-12 over-hide"><label class="w-100">请求地址：</label><span>{$api_info.request_url}</span></p>
            <p class="col-lg-12 over-hide"><label class="w-100">接口备注：</label><span>{$api_info.memo}</span></p>
        </div>
    </div>
    <div class="panel panel-primary">
        <div class="panel-heading">请求参数</div>
        <table class="table">
            <thead>
                <tr>
                    <td>参数名称</td>
                    <td>参数类型</td>
                    <td>是否必填</td>
                    <td>参数说明</td>
                    <td>默认值</td>
                </tr>
            </thead>
            <tbody>
                <foreach name="api_info.param" item="param">
                <tr class="params-row">
                    <td class="w-150">{$param.param_name}</td>
                    <td class="w-100">{$param['param_type']}</td>
                    <td class="w-100"><if condition="$param['param_must'] eq 1">必填<else />可选</if></td>
                    <td class="mw-100">{$param.param_intro}</td>
                    <td class="">{$param.param_default}</td>
                </tr>
                </foreach>
            </tbody>
            </table>
    </div>
    <div class="panel panel-info">
        <div class="panel-heading">
            <h3 class="panel-title">接口返回信息</h3>
        </div>
        <div class="panel-body">
            <p class="col-lg-12 over-hide"><label class="w-100">返回示例：</label><span id="return_example">{$api_info.return_example}</span></p>
            <p class="col-lg-12 over-hide"><label class="w-100">错误示例：</label><span id="error_example">{$api_info.error_example}</span></p>
        </div>
    </div>
    <div class="panel panel-primary">
        <div class="panel-heading">返回参数</div>
        <table class="table">
            <thead>
                <tr>
                    <td>参数名称</td>
                    <td>参数类型</td>
                    <td>参数说明</td>
                </tr>
            </thead>
            <tbody>
                <foreach name="api_info.ret_param" item="ret_param">
                <tr class="params-row">
                    <td class="col-lg-2">{$ret_param.ret_param_name}</td>
                    <td class="col-lg-2">{$ret_param['ret_param_type']}</td>
                    <td>{$ret_param.ret_param_intro}</td>
                </tr>
                </foreach>
            </tbody>
            </table>
    </div>
</div>
<script>
$(function(){
    var return_example = format($('#return_example').html());
    var error_example = format($('#error_example').html());

    if(return_example.success){
        $('#return_example').html('<pre class="show-json">'+return_example.content+'</pre>');
    }
    if(error_example.success){
        $('#error_example').html('<pre class="show-json">'+error_example.content+'</pre>');
    }
})
</script>
</block>